package com.wjs.callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> task = new FutureTask<>(() -> {
            System.out.println(Thread.currentThread().getName()+"come into callable");
            Thread.sleep(3000);
            return 666;
        });
        new Thread(task,"aa").start();
        System.out.println(task.get());
        System.out.println("main");
    }
}
